package openation;

import book.Book;
import book.BookList;
import openation.IOperation;

/**
 * 实现显示所有图书的操作ShowOperation类，继承接口IOperation，参数类型为BookList
 * 重写work方法，参数BookList，获取当前下标
 * 1遍历所有书籍，并输出书籍信息
 */
public class ShowOperation implements IOperation {

    @Override

    public void work(BookList bookList) {
        int currentSize = bookList.getCount();

        System.out.println("显示所有图书：");

        for (int i = 0; i < currentSize; i++) {

            Book book = bookList.getBook(i);

            System.out.println(book);
        }
    }
}
